<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        class cats {
            //写入要绑定给对象的属性
            name = "猫猫";
            age = 7;
        }
        //创建对象
        let cat = new cats();
        let cat1 = new cats();
        console.log(cat, cat1);
        //带有参数的类
        class Dog {
            constructor(name, age) {
                this.name = name;
                this.age = age;
            }
        }
        let dog1 = new Dog("erha", 2)
        let dog2 = new Dog("jinmao", 3)
        console.log(dog1, dog2);
        //es6 类实现混合式创建
        class Boy {
            constructor(name, age) {
                this.name = name;
                this.age = age;
            }
            say = function () {
                console.log("我爱你");

            }
        }
        let zs = new Boy("张三", 18);
        console.log(zs);


    </script>
</body>

</html>